package com.xyx.www;

import java.net.InetAddress;

public class Test0808 {
	
	public static void main(String[] args) {
	test01();
		
	}
private static void test01() {
	try {
		// 通过InetAddress静态方法getLocalHost方法返回本地主机对象
		InetAddress myIp = InetAddress.getLocalHost();
			System.out.println(myIp.getHostAddress());
			InetAddress myIp2=InetAddress.getByName("www.sohu.com");
			System.out.println(myIp2.getHostAddress());
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
}
